package com.abe.libquick.base;


import com.abe.libquick.base.mvp.BaseLogPresenter;
import com.abe.libquick.base.mvp.BaseView;

public abstract class MvpBaseActivity<V extends BaseView, P extends BaseLogPresenter<V>> extends BaseActivity {

    protected P mPresenter;

    protected abstract void initMvpContent();

    @Override
    public void initContent() {
        //创建Presenter
        mPresenter = createPresenter();
        //填充View
        if (mPresenter != null) {
            mPresenter.attachView((V) this);
        }
        initMvpContent();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mPresenter != null) {
            mPresenter.detachView();
        }
    }

    protected abstract P createPresenter();
}